# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 3/19/21 6:04 PM
# @Author : minvan
# @Email : jiangming8937@icloud.com
# @File : SuperPartner.robot
# @Software: PyCharm

*** Settings ***
Documentation  超级合伙人接口测试
Library  Collections
Library  RequestsLibrary
Library     ../SuperPartner/SuperPartner.py
Resource    ../SuperPartner/Variables/Params.txt
#Suite Setup  WriteParams
#Test Setup    Run keywords
#...    DestroyOrder     User=0
#...    AND    DestroyOrder      User=1
*** Keywords ***


*** Variables ***
#${domains}  https://a.heyuapp.cn/spcp/webapi
#${domains}   https://a.heyuapp.cn/spcpbeta/webapi
#${Cookie}   teamRole=InJvbGU9Tm9uZSZ0ZWFtSWQ9MCI.-2fKejolEXX1jI6S0BDhHnPOFtc;spcpbeta-session=.eJwljkGOAyEMBP9CrjkYG7DJZ5DBZjOHlaKZiXKI8vew2nNXl-od2tz9uIfbuT_9Gtpm4RawTy82MJsKikev3M2SZMNEDpGJkFwjuQFYh0KCcZgUYIlYKmfURJiE4zpoYqRl7FZliMByzQygzGQZhy-tTe7VhMZUmVzCCnkevv_X1Ah0uWg7HuPRup_6N7-2895-9WcbiwifL1C9OaA.YN6PNg.AUcJQ_nicc7uZCfiiwxw65yw7IM


*** Test Cases ***

0001
    [Tags]  服务节点详情 ---- ⚠️暂时没有用到⚠️
    CREATE SESSION  SiteDetail      ${domains}  verify=True
    ${headers}  CREATE DICTIONARY   Content-Type=application/json  charset=utf-8   Cookie=${Cookie}
    LOG TO CONSOLE  ${headers}
    ${resps}    POST REQUEST    SiteDetail      /site/detail        headers=${headers}
    LOG TO CONSOLE  ${resps.content.decode()}
#    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
#    ${resp}     TO JSON     ${resps.content}
#    SHOULD BE EQUAL AS STRINGS  ${resp}[status]     1
#    SHOULD BE EQUAL AS STRINGS  ${resp}[msg]    success
#    SHOULD BE EQUAL AS STRINGS  ${resp}[result][siteId]     XX2141421
#    SHOULD BE EQUAL AS STRINGS  ${resp}[result][siteName]   北京

0002
    [Tags]  计费模板详情
    CREATE SESSION      FeetempDetail    ${domains}      verify=True
    ${headers}  CREATE DICTIONARY   Content-Type=application/json  charset=utf-8   Cookie=${Cookie}     User-Agent=${User-Agent}    Accept-Encoding=${Accept-Encoding}
    ${data}     CREATE DICTIONARY  tempId=public.12228
    ${resps}    POST REQUEST    FeetempDetail     /site/feetemp/detail        json=${data}    headers=${headers}
    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
    ${resp}     TO JSON  ${resps.content}
    LOG TO CONSOLE  ${resp}



0003
    [Tags]  计费模板详情查看
    CREATE SESSION  FeetempInfo     ${domains}  verify=True
    ${headers}  CREATE DICTIONARY   Content-Type=application/json  charset=utf-8   Cookie=${Cookie}     User-Agent=${User-Agent}    Accept-Encoding=${Accept-Encoding}
    ${data}     CREATE DICTIONARY   feeTempId=public.12228     orderNo=684133400104
    ${resps}    POST REQUEST    FeetempInfo     /site/feetemp/info
    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}        200
    ${resp}     TO JSON     ${resps.content}
    LOG TO CONSOLE  ${resp}

0004
    [Tags]  合伙人自己的计费模板列表，每个模板还有收费码数量
    CREATE SESSION  FeetempList     ${domains}      verify=True
    ${headers}  CREATE DICTIONARY   Content-Type=application/json  charset=utf-8   Cookie=${Cookie}     User-Agent=${User-Agent}    Accept-Encoding=${Accept-Encoding}
    ${resps}    GET REQUEST  FeetempList    /site/feetemp/list      headers=${headers}
    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
    ${resp}     TO JSON     ${resps.content}
    LOG TO CONSOLE  ${resp}

0005
    [Tags]  当前城市支持的标准内置计费模板，如D、E模板
    CREATE SESSION      FeetempStandard     ${domains}      verify=True
    ${headers}  CREATE DICTIONARY   Content-Type=application/json  charset=utf-8   Cookie=${Cookie}     User-Agent=${User-Agent}    Accept-Encoding=${Accept-Encoding}
    ${data}    CREATE DICTIONARY  curCity=杭州
    ${resps}    POST REQUEST    FeetempStandard     /site/feetemp/standard      json=${data}        headers=${headers}
    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
    ${resp}     TO JSON     ${resps.content}
    LOG TO CONSOLE  ${resp}



0006_1
    [Tags]  计费模板信息提交，包括新增模板、更新模板信息----add
    CREATE SESSION      FeetempSubmit       ${domains}      verify=True
    ${headers}  CREATE DICTIONARY   Content-Type=application/json  charset=utf-8   Cookie=${Cookie}     User-Agent=${User-Agent}    Accept-Encoding=${Accept-Encoding}
    ${data}
#    	https://a.heyuapp.cn/spcpdev/mock/site/feetemp/submit?mock=1&__limit_retcode__=all

0006_2
    [Tags]  计费模板信息提交，包括新增模板、更新模板信息----update
    CREATE SESSION      FeetempSubmit   ${domains}  verify=True
    ${headers}  CREATE DICTIONARY   Content-Type=application/json  charset=utf-8   Cookie=${Cookie}     User-Agent=${User-Agent}    Accept-Encoding=${Accept-Encoding}
    ${data}

0007
    [Tags]  	添加车队
    CREATE SESSION      FleetAdd        ${domains}      verify=True
    ${headers}  CREATE DICTIONARY   Content-Type=application/json  charset=utf-8   Cookie=${Cookie}     User-Agent=${User-Agent}    Accept-Encoding=${Accept-Encoding}
    ${data}     CREATE DICTIONARY   enterScene=${enterScene}    cid=${cid}  type=add    p=${p}   appid=${appid}     aid=${aid}     name=TestRobot   logo=${logo}    buyValue=5  sellValue=5     regionScopeCode=330100  deliverFeetempId=public.12065   deliverScope=TEAM
    ${resps}     POST REQUEST    FleetAdd        /site/fleet/add     json=${data}       headers=${headers}
    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
    ${resp}     TO JSON     ${resps.content}
    LOG TO CONSOLE  ${resp}
    SHOULD BE EQUAL AS STRINGS  ${resp}[status]     1
    SHOULD BE EQUAL AS STRINGS  ${resp}[msg]    success
    DICTIONARY SHOULD CONTAIN KEY  ${resp}[result]      fleetId



0008
    [Tags]  车队头像信息更新
    CREATE SESSION  FleetUpdate     ${domains}      verify=True
    ${headers}  CREATE DICTIONARY   Content-Type=application/json  charset=utf-8   Cookie=${Cookie}     User-Agent=${User-Agent}    Accept-Encoding=${Accept-Encoding}
    ${data}     CREATE DICTIONARY   enterScene=${enterScene}    cid=${cid}  fleetId=XCW0DRFKK  p=${p}  appid=${appid}  app=${app}  aid=${aid}  logo=https://hjcx8888.feishu.cn/docs/doccnROQT0rp7wtC1Se5r5ORUOd#QFZbgh
    ${resps}    POST REQUEST    FleetUpdate     /site/fleet/update      json=${data}    headers=${headers}
    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
    ${resp}     TO JSON     ${resps.content}
    LOG TO CONSOLE  ${resp}
    ###################################################################################XCW0DRFKK
    #https://www.google.com/logos/doodles/2021/professor-sir-ludwig-guttmanns-122nd-birthday-6753651837108979-l.png

#0002_a
#    [Tags]  添加车队
#    CREATE SESSION  FleetAdd    ${domains}      verify=True
#    ${headers}      CREATE DICTIONARY  Content-Type=application/json  charset=utf-8   Cookie=${Cookie}
#    ${data}     CREATE DICTIONARY   a=b
#
#
#0003
#    [Tags]  车队头像信息更新
#    CREATE SESSION  AvatarUpdate    ${domains}      verify=True
#    ${headers}      CREATE DICTIONARY  Content-Type=application/json  charset=utf-8   Cookie=${Cookie}
#    ${data}     CREATE DICTIONARY
#
#
#0004
#    [Tags]  车队详情
#    CREATE SESSION  FleetDetail     ${domains}      verify=True
#    ${headers}      CREATE DICTIONARY  Content-Type=application/json  charset=utf-8   Cookie=${Cookie}
##    ${data}     CREATE DICTIONARY
#    ${resps}    GET REQUEST       FleetDetail       /site/fleet/detail      headers=${headers}
##    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
#    ${resp}     TO JSON         ${resps.content}
#    LOG TO CONSOLE  ${resp}
#
#
#0005
#    [Tags]  添加车队司机
#    CREATE SESSION  DriverAdd   ${domains}      verify=True
#    ${headers}      CREATE DICTIONARY   Content-Type=application/json  charset=utf-8   Cookie=${Cookie}
#    ${data}        CREATE DICTIONARY  fleetId=XSDFAA0       driverId=XSDAWS9
#    ${resps}    POST REQUEST     DriverAdd       /site/fleet/driver/add     json=${data}        headers=${headers}
#    SHOULD BE EQUAL AS STRINGS      ${resps.status_code}        200
#    ${resp}     TO JSON     ${resps.content}
#    LOG TO CONSOLE  ${resps.content}
#    SHOULD BE EQUAL AS STRINGS  ${resp}[status]     1
#    SHOULD BE EQUAL AS STRINGS  ${resp}[msg]    success
#
#
#0006
#    [Tags]  车队司机详情
#    CREATE SESSION  DriverDetail        ${domains}      verify=True
#    ${headers}      CREATE DICTIONARY   Content-Type=application/json  charset=utf-8   Cookie=${Cookie}
#    ${data}     CREATE DICTIONARY   driverId=23
#    ${resps}    POST REQUEST    DriverDetail        /site/fleet/driver/detail         json=${data}        headers=${headers}
#    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}        200
#    LOG TO CONSOLE  ${resps.content}
#    ${resp}     TO JSON     ${resps.content}
#    SHOULD BE EQUAL AS STRINGS  ${resp}[status]     1
#    SHOULD BE EQUAL AS STRINGS  ${resp}[msg]        success
#    SHOULD BE EQUAL AS STRINGS  ${resp}[result][detail][id]     124324
#
#
#0007
#    [Tags]  车队司机列表
#    CREATE SESSION  FleetDriverList     ${domains}      verify=True
#    ${headers}      CREATE DICTIONARY   Content-Type=application/json  charset=utf-8   Cookie=${Cookie}
#    ${data}     CREATE DICTIONARY  bdate=20210609       edate=20220609      keys=Minvan     type=order/deliver      pageSize=20     pageIndex=1     filters={"city": "杭州", "status": "driving"}
#    ${resps}    POST REQUEST    FleetDriverList        /site/fleet/driver/list         json=${data}        headers=${headers}
#    LOG TO CONSOLE  ${resps.content}
#    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
#    ${resp}     TO JSON     ${resps.content}
#    SHOULD BE EQUAL AS STRINGS      ${resp}[status]     1
#    SHOULD BE EQUAL AS STRINGS      ${resp}[msg]        success
#    SHOULD BE EQUAL AS STRINGS      ${resp}[result][driverList][0][id]      124324
#    ${driverList}       GET LENGTH      ${resp}[result][driverList]
#    LENGTH SHOULD BE    ${resp}[result][driverList]     ${driverList}
#    DICTIONARY SHOULD CONTAIN KEY  ${resp}[result][driverList][0]      headImgUrl
#    DICTIONARY SHOULD CONTAIN KEY  ${resp}[result][driverList][0]      name
#    DICTIONARY SHOULD CONTAIN KEY  ${resp}[result][driverList][0]      phone
#    DICTIONARY SHOULD CONTAIN KEY  ${resp}[result][driverList][0]      status
#
#
#0008
#    [Tags]  删除车队司机
#    CREATE SESSION      FleetDriverRemove   ${domains}      verify=True
#    ${headers}      CREATE DICTIONARY  Content-Type=application/json  charset=utf-8   Cookie=${Cookie}
#    ${data}     CREATE DICTIONARY       fleetId=XSDFAA0     driverId=XSDAWS9
#    ${resps}    POST REQUEST        FleetDriverRemove       /site/fleet/driver/remove       json=${data}        headers=${headers}
#    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}        200
#    LOG TO CONSOLE      ${resps.content}
#    ${resp}     TO JSON     ${resps.content}
#    SHOULD BE EQUAL AS STRINGS      ${resp}[status]         1
#    SHOULD BE EQUAL AS STRINGS      ${resp}[msg]        success
#    DICTIONARY SHOULD CONTAIN KEY   ${resp}     result
#
#
#0009
#    [Tags]  管理车队司机状态（拉黑，关闭接单权限，踢出团队）
#    CREATE SESSION      FleetDriverSetting      ${domains}      verify=True
#    ${headers}      CREATE DICTIONARY  Content-Type=application/json  charset=utf-8   Cookie=${Cookie}
#    ${data}     CREATE DICTIONARY   fleetId=XSDFAA0     driverId=XSDAWS9    canReceive=1    kickOff=1       addBlack=1
#    ${resps}    POST REQUEST  FleetDriverSetting    /site/fleet/driver/setting      json=${data}    headers=${headers}
#    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
#    LOG TO CONSOLE      ${resps.content}
#    ${resp}     TO JSON     ${resps.content}
#    SHOULD BE EQUAL AS STRINGS  ${resp}[status]     1
#    SHOULD BE EQUAL AS STRINGS  ${resp}[msg]    success
#    DICTIONARY SHOULD CONTAIN KEY  ${resp}      result
#
#
#0010
#    [Tags]  车队计费规则详情
#    CREATE SESSION      FeeRuleDetail       ${domains}      verify=True
#    ${headers}      CREATE DICTIONARY  Content-Type=application/json  charset=utf-8   Cookie=${Cookie}
#    ${resps}    GET REQUEST     FeeRuleDetail       /site/fleet/feerule/detail
#    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
#    ${resp}     TO JSON     ${resps.content}
#    LOG TO CONSOLE      ${resp}
#    SHOULD BE EQUAL AS STRINGS  ${resp}[status]     1
#    SHOULD BE EQUAL AS STRINGS  ${resp}[msg]        success
#    SHOULD BE EQUAL AS STRINGS  ${resp}[result][buyValue]     5
#    SHOULD BE EQUAL AS STRINGS  ${resp}[result][buyValueHint]   5元/单
#
#
#0011
#    [Tags]  车队计费规则更新
#    CREATE SESSION  FeeRuleUpdate   ${domains}      verify=True
#    ${headers}  CREATE DICTIONARY  Content-Type=application/json  charset=utf-8   Cookie=${Cookie}
#    ${data}     CREATE DICTIONARY  fleetId=XS0SDAF      buyValue=5      sellValue=5     deliverFeetempId=public.12388   deliverScope=team   joinAudit=3     joinAuditRule= {"driverAgeFloor": 3, "ageCeil": 55}}
#    ${resps}    POST REQUEST    FeeRuleUpdate       /site/fleet/feerule/update     json=${data}        headers=${headers}
#    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
#    LOG TO CONSOLE  ${resps.content.decode()}
#    ${resp}     TO JSON  ${resps.content}
#    SHOULD BE EQUAL AS STRINGS  ${resp}[status]     1
#    SHOULD BE EQUAL AS STRINGS  ${resp}[msg]        success
#    DICTIONARY SHOULD CONTAIN KEY  ${resp}      result
#
#
#0012
#    [Tags]  添加车队初始化
#    CREATE SESSION  FleetInit   ${domains}      verify=True
#    ${headers}  CREATE DICTIONARY  Content-Type=application/json  charset=utf-8   Cookie=${Cookie}
#    ${resps}    GET REQUEST  FleetInit      /site/fleet/init        headers=${headers}
#    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
#    LOG TO CONSOLE  ${resps.content.decode()}


































